import React, { Component } from 'react'
import { withRouter } from "react-router-dom"
class Header extends Component {

  render() {
    const { history } = this.props
    return (
      <div>
        <h2>React Router Demo</h2>

        <button onClick={() => { history.goForward() }}>前进</button>
        <button onClick={() => { history.goBack() }}>后退</button>
        <button onClick={() => { history.go(2) }}>前进2</button>
        <button onClick={() => { history.go(-2) }}>后退2</button>
      </div>
    )
  }
}

export default withRouter(Header)